﻿<%@ Page Language="C#" validateRequest="false" AutoEventWireup="true" CodeBehind="TemplateEdit.aspx.cs" Inherits="hcms.Admin.TemplateEdit" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>编辑模板</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<link href="Styles/rightframe.css" rel="stylesheet" type="text/css" />
	<script src="/Scripts/jquery.min.161.js" type="text/javascript"></script>
	<script src="/Scripts/comm.js" type="text/javascript"></script>
	<script src="js/admin.js" type="text/javascript"></script>
	<script type="text/javascript">
		var submitting = false;
		function onsave() {
			try {
				//$("#idsubmit")[0].disabled = true; //?? 防止重复提交，不能防止页面刷新
				if (submitting) //?? 防止重复提交，不能防止页面刷新
					return;

				submitting = true;
				$(".submitstate").html("......");

				$("#idname").verifyEmpty();
				$("#code").verifyEmpty();
				$("#cmd").val("save");
				//$("#code").val($("#code").val().replace(new RegExp("<", "gm"), "&1l1t1;"));
				form1.submit();
			}
			catch (err) {
				alert(err.message);
				submitting = false;
				//$("#idsubmit")[0].disabled = false;
			}
		}

		$(function () {
			$(window).resize(function () {
				onsize();
			});

			onsize();
			function onsize() {
				$("#code").height($(window).height() - 215);
				$("#code").width($(window).width() - 30);
				$("input[type=text]").width($(window).width() - 70);
			}
		});
	</script>
</head>
<body>
    <form id="form1" runat="server">
	<input type="hidden" id="cmd" runat="server" />
	<div class="topdiv">
		模板管理 &gt;&gt; <a href="TemplateList.aspx?type=<% =type %>"><% =model.templatesName[type]%></a> &gt;&gt; <span id="htmaddedit" runat="server">0</span>&nbsp;&nbsp;&nbsp;
		<input type="button" onclick="onsave()" value="保存" />&nbsp;<span class="submitstate"><%=submitstate %></span>&nbsp;
		<input type="button" onclick="window.location='TemplateList.aspx?type=<% =type %>'" value="返回" />
	</div>
	<br /><span class="gray">名称：</span><input id="idname" type="text" runat="server" /><br /><br />
	<span class="gray">说明：</span><input id="description" type="text" runat="server" /><br /><br />
	<span class="gray">代码：</span><br />
	<textarea id="code" cols="20" rows="30" runat="server" onkeydown = "$('.submitstate').html('***');"></textarea><br /><br />
		<input type="button" onclick="onsave()" value="保存" />&nbsp;<span class="submitstate"><%=submitstate %></span>&nbsp;
		<input type="button" onclick="window.location='TemplateList.aspx?type=<% =type %>'" value="返回" />
    </form>
</body>
</html>
